package com.stadium.bean;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/*
 * 器材订单
 */
@Entity
@Table(name = "orders")
public class Order implements Serializable {

	private static final long serialVersionUID = 6381204917710088690L;

	// 订单编号
	private Integer id;
	// 订单描述
	// private String description;
	// 订单状态
	// 0:表示未审核 1:表示审核过了
	private Integer status;
	// 租借数量
	private Integer number;
	// 租借人标志 即账号或者id
	private String borrowAccount;
	// 租借人名字
	private String borrowName;
	// 联系方式
	private String telephone;
	// 订单时间
	private Date orderTime;
	// 申请归还
	// 0:为申请归还 1:申请
	private Integer applyReturn;
	// 判断是否归还
	// 0:未归还 1:归还
	private Integer isReturn;
	// 器材
	private Equipment equipment;

	public Order() {
		super();
	}

	public Order(Integer id, Integer status, Integer number,
			String borrowAccount, Date orderTime, Equipment equipment) {
		super();
		this.id = id;
		this.status = status;
		this.number = number;
		this.borrowAccount = borrowAccount;
		this.orderTime = orderTime;
		this.equipment = equipment;
	}

	public Order(Integer id, Integer status, Integer number,
			String borrowAccount, String borrowName, String telephone,
			Date orderTime, Integer applyReturn, Integer isReturn,
			Equipment equipment) {
		super();
		this.id = id;
		this.status = status;
		this.number = number;
		this.borrowAccount = borrowAccount;
		this.borrowName = borrowName;
		this.telephone = telephone;
		this.orderTime = orderTime;
		this.applyReturn = applyReturn;
		this.isReturn = isReturn;
		this.equipment = equipment;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(length = 3)
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "order_time")
	public Date getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(Date orderTime) {
		this.orderTime = orderTime;
	}

	@Column(length = 5, nullable = false)
	public Integer getNumber() {
		return number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}

	@Column(name = "borrow_account", length = 20, nullable = false)
	public String getBorrowAccount() {
		return borrowAccount;
	}

	public void setBorrowAccount(String borrowAccount) {
		this.borrowAccount = borrowAccount;
	}

	@Column(name = "borrow_name", length = 20, nullable = false)
	public String getBorrowName() {
		return borrowName;
	}

	public void setBorrowName(String borrowName) {
		this.borrowName = borrowName;
	}

	@Column(length = 20, nullable = false)
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	@Column(name = "is_return", length = 2, nullable = false)
	public Integer getIsReturn() {
		return isReturn;
	}

	public void setIsReturn(Integer isReturn) {
		this.isReturn = isReturn;
	}

	@Column(name = "apply_return", length = 2, nullable = false)
	public Integer getApplyReturn() {
		return applyReturn;
	}

	public void setApplyReturn(Integer applyReturn) {
		this.applyReturn = applyReturn;
	}

	@JoinColumn(name = "equipment_id")
	@OneToOne
	public Equipment getEquipment() {
		return equipment;
	}

	public void setEquipment(Equipment equipment) {
		this.equipment = equipment;
	}

}
